package com.zige.zige.task;

import android.app.Activity;
import android.content.Context;

import java.io.Serializable;
import java.util.Map;

/**
 * 所有任务类的父类,实现Runnable接口，子线程中处理任务
 * Created by kim-wu on 2015/3/25.
 */
public abstract class ITask implements Runnable,Serializable {

    protected Map<String, String> params;
    protected Activity context;
    protected String url;
    protected ITask() {

    }

    protected ITask(Map<String, String> params, Context context) {
        this.params = params;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Activity context) {
        this.context = context;
    }

    public Map<String, String> getParams() {
        return params;
    }

    public void setParams(Map<String, String> params, Activity context) {
        this.params = params;
                                                              this.context = context;
    }


    @Override
    public void run() {
        handleTask();
    }

    public abstract void handleTask();
    public abstract void stop();
    public interface CallBack {
        void onSuccess(String code);
        void onfaile(String msg);
    }
}
